package com.ruoyi.merchant.controller;

import com.ruoyi.common.core.cg.dto.QueryPageBean;
import com.ruoyi.common.core.cg.pojo.Order;
import com.ruoyi.common.core.cg.result.PageResult;
import com.ruoyi.merchant.service.OrderService;
import com.ruoyi.merchant.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    //查询已提货的订单数额
    @GetMapping("/selectOrderByStatus")
    public int selectOrderByStatus(int leaderId)
    {
        return orderService.selectOrderByStatus(leaderId);
    }
    //查询未提货的订单数额
    @GetMapping("/selectOrderByStatus1")
    public int selectOrderByStatus1(int leaderId)
    {
        return orderService.selectOrderByStatus1(leaderId);
    }
    //查询订单列表
    @PostMapping("/selectOrderList")
    public PageResult selectOrderList(QueryPageBean queryPageBean){
        return orderService.selectOrderList(queryPageBean);
    }

    @RequestMapping("/list")
    public Result dtoList(@RequestParam("lid") Integer lid){
        List<Order> orderList = orderService.dtoList(lid);
        return new Result(200,"查询成功",orderList);
    }

    @RequestMapping("/status")
    public Result dtoListStatus(@RequestParam("lid") Integer lid){
        List<Order> orderList = orderService.dtoListStatus(lid);
        return new Result(200,"查询成功",orderList);
    }
}
